// import Taro from '@tarojs/taro';
import { banners } from '../../utils/api';

export default {
  namespace: 'index',
  state: {
    banner: [],
  },

  effects: {
    * getBanner({ payload }, { call, put }) {
      const result = yield call(banners, {
        ...payload
      })
      yield put({
        type: 'updateStateWithBanner',
        payload: {
          banner: result
        }
      })
    },
  },

  reducers: {
    updateStateWithBanner(state, { payload: banner }) {
      return { ...state, ...banner }
    },
  }

}
